from flask import Flask
from .extensions import db, cors



def create_app(config_name="development"):
    app = Flask(__name__)
    app.config.from_object(f"config.{config_name}.DevelopmentConfig")

    # 调试：打印数据库 URI
    print("当前数据库 URI:", app.config.get("SQLALCHEMY_DATABASE_URI"))

    db.init_app(app)
    return app